package com.xj.toOffer.nowCoder;

/**
 * @author: xujiang
 * @createTime: 2021/7/21 16:23:49
 */
public class JZ18 {
    public TreeNode Mirror (TreeNode pRoot) {
        // write code here
        if (pRoot == null) {
            return pRoot;
        }
        if (pRoot.left != null){
            Mirror(pRoot.left);
        }
        if (pRoot.right != null) {
            Mirror(pRoot.right);
        }
        TreeNode tmp = pRoot.left;
        pRoot.left = pRoot.right;
        pRoot.right = tmp;
        return pRoot;
    }
}
